/*
    This file is part of Epoch <http://code.google.com/p/epoch/>.

    Copyright (C) 2011 Adam Meily <meily.adam@gmail.com>

    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 2 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License along
    with this program; if not, write to the Free Software Foundation, Inc.,
    51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/


#include "Device.h"
// done

Device::Device()
{
}

Device::Device(const Device& other)
        : m_uuid(other.m_uuid), m_key(other.m_key), m_shares(other.m_shares),
          Model(other)
{
}

Device::Device(int id, const QByteArray& uuid, const QByteArray& key)
        : Model(id), m_uuid(uuid), m_key(key)
{
}

Device::~Device()
{

}


Device& Device::operator=(const Device& other)
{
    m_key = other.m_key;
    m_shares = other.m_shares;
    m_uuid = other.m_uuid;
    Model::operator=(other);
    return *this;
}

const QList< Share >& Device::shares() const
{
    return m_shares;
}

const QByteArray& Device::uuid() const
{
    return m_uuid;
}


const QByteArray& Device::key() const
{
    return m_key;
}

bool Device::isNull() const
{
    return m_uuid.isEmpty();
}

void Device::inject(const QList< Share >& shares)
{
    m_shares = shares;
}

